import urllib, urllib2, cookielib
import operator
import re
from com.mtc.util.connector import Connector

bbs = Connector(user, passwd)
posts = {}

#url = 'http://www.mitbbs.com/mitbbs_mailbox.php?option=receive&path=r'
#page_data = bbs.get_page(url)
#print page_data

#m = re.search("type=receive&mail_total=(\d+)", page_data)
#total = int(m.group(1))

url = 'http://www.mitbbs.com/mitbbs_mailbox.php?option=read&dir=r&num=0'
page_data = bbs.get_page(url)

#print page_data

m = re.search("<p class=\"jiawenzhang-type\">(.*?)</p>", page_data)
s = m.group(1)
s = re.sub("<br />", "<br />\n", s)
print s

#f = open("test.html", "w")
#f.write(s)
#f.close()